aggregation should count distinct array elements